import { Enums } from '@/utils/enums'

export function isHttp(docInfo) {
  return docInfo.type === Enums.DOC_TYPE.HTTP
}

export function isDubbo(docInfo) {
  return docInfo.type === Enums.DOC_TYPE.DUBBO
}

export function isCustom(docInfo) {
  return docInfo.type === Enums.DOC_TYPE.CUSTOM
}

export function isShowRequestExample(docInfo) {
  // 增加导出文件时，xml示例展示内容
  // return isHttp(docInfo) && docInfo.contentType && docInfo.contentType.toLowerCase().indexOf('json') > -1
  return isHttp(docInfo) && docInfo.contentType && (docInfo.contentType.toLowerCase().indexOf('json') > -1 || docInfo.contentType.toLowerCase().indexOf('xml') > -1)
}
